package String;

import java.util.Locale;

public class Practice {
    public static void main(String[] args) {

        String str = "i love java";
        int len = str.length();
        System.out.println(len);

        str=str.trim();
        System.out.println(str);

        String upper=str.toUpperCase();
        System.out.println(upper);
        String lower=str.toLowerCase();
        System.out.println(lower);

        char a=str.charAt(6);
        System.out.println(a);

        boolean stars=str.startsWith("i");
        System.out.println(stars);
        boolean ends=str.endsWith(".");
        System.out.println(ends);

        int index=str.indexOf("lo");
        System.out.println(index);
        index=str.indexOf("a",7);
        System.out.println(index);
        index=str.indexOf("aaaa");
        System.out.println(index);
        index=str.lastIndexOf("a");
        System.out.println(index);

        int start=str.indexOf("i");
        int end=str.indexOf("j");
        String name=str.substring(start,end);
        System.out.println(name);

        int s=111;
        String s1=String.valueOf(s);
        System.out.println(s1);
        /*
        String str="think in java";
        char c= str.charAt(9);
        System.out.println(c);



        String str="thinking in java";
        int index=str.indexOf("in");
        System.out.println(index);

        index=str.indexOf("in",3);
        System.out.println(index);

        index=str.indexOf("abc");
        System.out.println(index);

        index=str.lastIndexOf("in");
        System.out.println(index);



         String str="我爱JAVA";
        int len=str.length();
        System.out.println(len);\



        int a=123;
        String s1=String.valueOf(a);
        System.out.println(s1);

        double b=123.456;
        String s2=String.valueOf(b);
        System.out.println(s2);

        String s3=b+"";
        System.out.println(s3);


        String str="    hello   word    ";
        str=str.trim();
        System.out.println(str);


         String str="我爱Java";
        String upper=str.toUpperCase();
        System.out.println(upper);
        String lower=str.toLowerCase();
        System.out.println(lower);



        String str="www.tedu.cn";
        int start=str.indexOf(".")+1;
        int end=str.indexOf(".",start);
        String name=str.substring(start,end);
        System.out.println(name);




         String s1="123abc";
        String s2="123abc";
        String s3="123abc";
        System.out.println(s1==s2);
        System.out.println(s1==s3);
        s3=s3+"!";
        System.out.println(s1==s3);
        String s4="123"+"abc";
        System.out.println(s1==s4);
        String s5="123";
        String s6=s5+"abc";
        System.out.println(s6==s1);

        String s=new String("hello");
        String s8="hello";
        System.out.println(s==s8);
        System.out.println(s.equals(s8));



        String str="think in java";
        boolean starts=str.startsWith("think");
        System.out.println(starts);
        boolean ends=str.endsWith(".png");
        System.out.println(ends);
         */
    }
}
